﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DynamicChart.Data;
//using Sinochem.TMS.PurchaseChartService;

namespace DynamicChart.Web
{
    public static class DynamicChartFactory
    {
        public static IChartDataQuery GetQuery(string module)
        {
            if (module == "test")
            {
                return null;
            }
            #region purchase
            else if (module == "purchase-supplier")
            {
                return new Sinochem.TMS.PurchaseChartService.SupplierQuery();
            }
            else if (module == "purchase-product")
            {
                return new Sinochem.TMS.PurchaseChartService.ProductQuery();
            }
            else if (module == "purchase-department")
            {
                return new Sinochem.TMS.PurchaseChartService.DepartmentQuery();
            }
            else if (module == "purchase-area")
            {
                return new Sinochem.TMS.PurchaseChartService.AreaQuery();
            }
            else if (module == "purchase-category")
            {
                return new Sinochem.TMS.PurchaseChartService.CategoryQuery();
            }
            #endregion
            #region sales
            else if (module == "sales-contract")
            {
                return new Sinochem.TMS.SalesChartService.ContractQuery();
            }
            else if (module == "sales-customer")
            {
                return new Sinochem.TMS.SalesChartService.CustomerQuery();
            }
            else if (module == "sales-department")
            {
                return new Sinochem.TMS.SalesChartService.DepartmentQuery();
            }
            else if (module == "sales-product")
            {
                return new Sinochem.TMS.SalesChartService.ProductQuery();
            }
            else if (module == "sales-person")
            {
                return new Sinochem.TMS.SalesChartService.PersonQuery();
            }
            #endregion
            #region logistic
            else if (module == "logistic-aging")
            {
                return new Sinochem.TMS.LogisticChartService.AgingQuery();
            }
            else if (module == "logistic-count")
            {
                return new Sinochem.TMS.LogisticChartService.CountQuery();
            }
            else if (module == "logistic-flux")
            {
                return new Sinochem.TMS.LogisticChartService.FluxQuery();
            }
            else if (module == "logistic-structure")
            {
                return new Sinochem.TMS.LogisticChartService.StructureQuery();
            }
            #endregion
            else if (module == "rd")
            {
                return new Sinochem.Tms.RD.POAmountRanking();
            }
            return null;
        }

        public static IChartBuilder GetBuilder(string module)
        {
            if (module == "purchase")
            {
                return new Sinochem.TMS.PurchaseChartService.PurchaseBuilder();
            }
            else if (module == "purchase-supplier")
            {
                return new Sinochem.TMS.PurchaseChartService.SupplierBuilder();
            }
            else if (module == "sales")
            {
                return new Sinochem.TMS.SalesChartService.SalesBuilder();
            }
            else if (module == "logistic")
            {
                return new Sinochem.TMS.LogisticChartService.LogisticBuilder();
            }
            return null;
        }
    }
}